"""
Version: 0.1
Author: CarpeDiem
Date: 2022/7/15
Description: 动态规划
目标：找自列表元素之和的最大值
输入：1 -2 3 5 -3 2
输出：8

输入：0 -2 3 5 -1 2
输出：9

输入：-9 -2 -3 -5 -3
输出：-2
"""


def main():
    items = list(map(int, input().split()))
    overall = partial = items[0]
    for i in range(1, len(items)):
        partial = max(items[i], partial + items[i])
        overall = max(partial, overall)
    print(overall)


if __name__ == "__main__":
    main()